'\" te
.\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH SCTP_SEND 3SOCKET "Mar 19, 2004"
.SH NAME
sctp_send \- send message from an SCTP socket
.SH SYNOPSIS
.LP
.nf
\fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-lsocket\fR \fB -lnsl \fR \fB -lsctp \fR [ \fIlibrary\fR... ]
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/sctp.h>

\fBssize_t\fR \fBsctp_send\fR(\fBint\fR \fIs\fR, \fBconst void *\fR\fImsg\fR, \fBsize_t *\fR\fIlen\fR,
     \fBconst struct sctp_sndrcvinfo *\fR\fIsinfo\fR, \fBint\fR \fIflags\fR);
.fi

.SH DESCRIPTION
.LP
The \fBsctp_send()\fR function sends messages from one-to-one and one-to-many
style SCTP endpoints. The following parameters can be set:
.sp
.ne 2
.na
\fB\fIs\fR\fR
.ad
.RS 7n
Socket created by \fBsocket\fR(3SOCKET)
.RE

.sp
.ne 2
.na
\fB\fImsg\fR\fR
.ad
.RS 7n
Message to be sent
.RE

.sp
.ne 2
.na
\fB\fIlen\fR\fR
.ad
.RS 7n
Size of the message to be sent in bytes
.RE

.sp
.LP
The caller completes the \fIsinfo\fR parameter with values used to send a
message. Such values might include the stream number, payload protocol
identifier, time to live, and the SCTP message flag and context. For a
one-to-many socket, the association ID can be specified in the \fIsinfo\fR
parameter to send a message to the association represented in the ID.
.sp
.LP
Flags supported for \fBsctp_send()\fR are reserved for future use.
.SH RETURN VALUES
.LP
Upon successful completion, the \fBsctp_send()\fR function returns the number
of bytes sent. The function returns \fB-1\fR if an error occurs.
.SH ERRORS
.LP
The \fBsctp_send()\fR function fails under the following conditions.
.sp
.ne 2
.na
\fB\fBEBADF\fR\fR
.ad
.RS 16n
The \fIs\fR argument is an invalid file descriptor.
.RE

.sp
.ne 2
.na
\fB\fBENOTSOCK\fR\fR
.ad
.RS 16n
The \fIs\fR argument is not a socket.
.RE

.sp
.ne 2
.na
\fB\fBEOPNOTSUPP\fR\fR
.ad
.RS 16n
\fBMSG_ABORT\fR or \fBMSG_EOF\fR is set in the \fBsinfo_flags\fR field of
\fBsinfo\fR for a one-to-one style SCTP socket.
.RE

.sp
.ne 2
.na
\fB\fBEPIPE\fR\fR
.ad
.RS 16n
The socket is shutting down and no more writes are allowed.
.RE

.sp
.ne 2
.na
\fB\fBEAGAIN\fR\fR
.ad
.RS 16n
The socket is non-blocking and the transmit queue is full.
.RE

.sp
.ne 2
.na
\fB\fBENOTCONN\fR\fR
.ad
.RS 16n
There is no established association.
.RE

.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 16n
Control message length is incorrect.
.RE

.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 16n
Specified destination address does not belong to the association.
.RE

.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 16n
The \fBstream_no\fR is outside the number of outbound streams supported by the
association.
.RE

.sp
.ne 2
.na
\fB\fBEAFNOSUPPORT\fR\fR
.ad
.RS 16n
Address family of the specified destination address is other than \fBAF_INET\fR
or \fBAF_INET6\fR.
.RE

.SH ATTRIBUTES
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Evolving
_
MT-Level	Safe
.TE

.SH SEE ALSO
.LP
.BR in.h (3HEAD),
.BR socket.h (3HEAD),
.BR libsctp (3LIB),
.BR accept (3SOCKET),
.BR bind (3SOCKET),
.BR connect (3SOCKET),
.BR listen (3SOCKET),
.BR sctp_sendmsg (3SOCKET),
.BR sendmsg (3SOCKET),
.BR socket (3SOCKET),
.BR sctp (4P)
